Skip to content

fix(rag): keep agitation chart expansion without over-broad management matches#853

Merged
cursor[bot] merged 3 commits into
mainfrom
cursor/pr-queue-land-3084
Jul 18, 2026
Merged

fix(rag): keep agitation chart expansion without over-broad management matches#853
cursor[bot] merged 3 commits into
mainfrom
cursor/pr-queue-land-3084

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Consolidates the unique remaining intent from closed PR queue item fix(rag): eliminate source-backed latency tails #845 onto current main.
  • Expands agitation/arousal queries into medication-chart retrieval terms for real dose/route/chart/options phrasing.
  • Does not treat bare table or management as chart intent, so broad pharmacological-management and “which table covers…” queries keep the existing topic contract.
  • Closes the CI failure path from fix(rag): eliminate source-backed latency tails #845 (tests/clinical-search.test.ts over-expansion).

Verification

  • npm run test -- tests/clinical-search.test.ts (42/42)
  • Local full Vitest via verify:cheap path: clinical-search green; tests/pdf-extraction-budget.test.ts 2 failures reproduce on current main (pre-existing; unrelated)
  • Verification not run: npm run eval:retrieval:quality (provider-backed; needs explicit live-key approval)
  • UI verification not run: no UI/routing/styling change in this PR

Risk and rollout

  • Risk: low-medium; narrow retrieval query-normalization change for agitation medication-chart phrasing only.
  • Rollback: revert this PR.
  • Provider or production effects: None (no schema/live writes).

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes

    • Improved clinical search handling for agitation/arousal medication chart queries.
    • Enhanced matching when chart/options/listed cues appear alongside dosage/route-related terms.
    • Added broader fallback behavior when detailed dose-route information is missing.
  • Documentation

    • Updated review records with the latest PR batch screenshot queue review and merge/monitoring outcome, including performed checks and known limitations.

Keep medication-chart token expansion for dose/route/chart/options/listed
signals from the rag-tree4 clinical-search change, but drop bare "table"
and "management" triggers so topic lookups and pharmacological management
questions stay on the agitation arousal topic query.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d2be7fb9-ed6b-4cce-98fc-40f1b3798c44

📥 Commits

Reviewing files that changed from the base of the PR and between 00b9f1b and 51af6d1.

📒 Files selected for processing (1)
  • src/lib/clinical-search.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/clinical-search.ts

📝 Walkthrough

Walkthrough

The clinical search query builder recognizes additional agitation medication-chart cues and applies broader fallback tokens. The branch review ledger gains a 2026-07-18 record for the PR batch screenshot queue review.

Changes

Clinical search query expansion

Layer / File(s) Summary
Medication-chart query expansion
src/lib/clinical-search.ts
Chart, options, and listing cues can qualify agitation medication-chart expansion, with broader medication, chart, dose, and route tokens used when extracted dose-route terms are empty.

Review ledger record

Layer / File(s) Summary
Review record entry
docs/branch-review-ledger.md
Adds the 2026-07-18 PR batch screenshot queue review record, including the reviewed HEAD, outcomes, checks, and constraints.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: codex

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main retrieval-query change.
Description check ✅ Passed The description follows the template with summary, verification, risk, governance preflight, and notes sections filled in.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/pr-queue-land-3084

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jul 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@cursor
cursor Bot marked this pull request as ready for review July 18, 2026 13:01
Document which screenshot-queue PRs were closed as superseded or unsafe,
and that the unique clinical-search fix continues in #853.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #3281 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

Satisfy Prettier so Static PR checks pass on the consolidation PR.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor
cursor Bot merged commit 7e4ddc3 into main Jul 18, 2026
16 checks passed
@cursor
cursor Bot deleted the cursor/pr-queue-land-3084 branch July 18, 2026 13:07
cursor Bot pushed a commit that referenced this pull request Jul 18, 2026
Note hosted green merge of the clinical-search fix and closure of
duplicate remediations #854/#855 that appeared during babysit.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants